<?php


namespace FoxLib\Services;


class UrlParamsService
{
    public static function encode(array $attributes)
    {
        ksort($attributes);
        return md5(json_encode($attributes)) . ':' . base64_encode(json_encode($attributes));
    }

    public static function decode(string $encryptStr)
    {
        $strInfo = explode(':', $encryptStr);
        $info = json_decode(base64_decode($strInfo[1]), true);
        return $info;
    }
}